package org.example.mybatis.mapper;

import org.example.mybatis.model.UserInfo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;


@SpringBootTest
class IUserInfoMapper2Test {

    @Autowired
    private IUserInfoMapper2 iUserInfoMapper2;

    @Test
    void insertUserInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername("zhangsan");
        userInfo.setPassword("666");
        userInfo.setAge(13);
        userInfo.setGender(1);
        iUserInfoMapper2.insertUserInfo(userInfo);
    }

    @Test
    void insertUserInfo1() {
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername("zhangsan222");
        userInfo.setPassword("222");
        userInfo.setAge(13);
//        userInfo.setGender(1);
        iUserInfoMapper2.insertUserInfo1(userInfo);
    }

    //存在，风险
    @Test
    void insertUserInfo2() {
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername("zhangwu");
        userInfo.setPassword("123");
        userInfo.setAge(19);
//        userInfo.setGender(1);
        iUserInfoMapper2.insertUserInfo2(userInfo);
    }

    @Test
    void insertUserInfo3() {
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername("zhangwu");
        userInfo.setPassword("123");
        userInfo.setAge(19);
//        userInfo.setGender(1);
        iUserInfoMapper2.insertUserInfo3(userInfo);
    }

    @Test
    void selectUserinfo1() {
        UserInfo userInfo = new UserInfo();
//        userInfo.setUsername("zhangwu");
        userInfo.setAge(18);
        iUserInfoMapper2.selectUserinfo1(userInfo);
    }


    @Test
    void updateUserinfo1() {
        UserInfo userInfo = new UserInfo();
        userInfo.setAge(12);
        userInfo.setPassword("888888");
        userInfo.setId(2);
        iUserInfoMapper2.updateUserinfo1(userInfo);
    }
}